package com.baoxin.chenxixc4coach.utils;

import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;

/**
 * 默认的确定取消对话框
 */
public class DialogUtil {

    public static void showTwoButtonDialog(Context context, String title, String content, DialogInterface.OnClickListener listener) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        if (null != title) {
            builder.setTitle(title);
        }
        builder.setMessage(content);
        builder.setPositiveButton("确定", listener);
        builder.setNegativeButton("取消", listener);
        AlertDialog dialog = builder.create();
        dialog.show();//先show下方才不为null
        dialog.getButton(dialog.BUTTON_POSITIVE).setTextColor(0xFF4CB9F7);
        dialog.getButton(dialog.BUTTON_NEGATIVE).setTextColor(0xFF4CB9F7);

    }

    public static void showOneButtonDialog(Context context, String title, String content, DialogInterface.OnClickListener listener) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        if (null != title) {
            builder.setTitle(title);
        }
        builder.setMessage(content);

        //这个确认实际是diss对话框的作用
        builder.setNegativeButton("确认", listener);
        AlertDialog dialog = builder.create();
        dialog.show();//先show下方才不为null
        dialog.getButton(dialog.BUTTON_NEGATIVE).setTextColor(0xFF4CB9F7);

    }

}
